From 41fbca5b47839944ab961c91d19060a91083406a Mon Sep 17 00:00:00 2001 From: Robert Lipe Date: Sun, 8 Dec 2019 19:11:48 -0600 Subject: [PATCH] Make GPX internal promotions/reductions more specific. Automated cleanups courtesy Clion. --- gpx.cc | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/gpx.cc b/gpx.cc index ab20dfe23..f171ab082 100644 --- a/gpx.cc +++ b/gpx.cc @@ -557,7 +557,7 @@ start_something_else(const QString& el, const QXmlStreamAttributes& attr) return; } - xml_tag* new_tag = new xml_tag; + auto* new_tag = new xml_tag; new_tag->tagname = el; int attr_count = attr.size(); @@ -593,7 +593,7 @@ start_something_else(const QString& el, const QXmlStreamAttributes& attr) new_tag->parent = cur_tag; } } else { - fs_xml* fs_gpx = (fs_xml*)fs_chain_find(*fs_ptr, FS_GPX); + auto* fs_gpx = (fs_xml*)fs_chain_find(*fs_ptr, FS_GPX); if (fs_gpx && fs_gpx->tag) { cur_tag = fs_gpx->tag; @@ -624,7 +624,7 @@ static void tag_log_wpt(const QXmlStreamAttributes& attr) { /* create a new waypoint */ - Waypoint* lwp_tmp = new Waypoint; + auto* lwp_tmp = new Waypoint; /* extract the lat/lon attributes */ if (attr.hasAttribute("lat")) { @@ -903,7 +903,6 @@ xml_parse_time(const QString& dateTimeString) static void gpx_end(const QString&) { - float x; int passthrough; static QDateTime gc_log_date; @@ -976,8 +975,7 @@ gpx_end(const QString&) wpt_tmp->AllocGCData()->type = gs_mktype(cdatastr); break; case tt_cache_difficulty: - x = cdatastr.toDouble(); - wpt_tmp->AllocGCData()->diff = x * 10; + wpt_tmp->AllocGCData()->diff = cdatastr.toFloat() * 10; break; case tt_cache_hint: wpt_tmp->AllocGCData()->hint = cdatastr; @@ -995,8 +993,7 @@ gpx_end(const QString&) } break; case tt_cache_terrain: - x = cdatastr.toDouble(); - wpt_tmp->AllocGCData()->terr = x * 10; + wpt_tmp->AllocGCData()->terr = cdatastr.toFloat() * 10; break; case tt_cache_placer: wpt_tmp->AllocGCData()->placer = cdatastr; @@ -1177,7 +1174,7 @@ gpx_end(const QString&) wpt_tmp->SetCreationTime(xml_parse_time(cdatastr)); break; case tt_wpttype_geoidheight: - WAYPT_SET(wpt_tmp, geoidheight, cdatastr.toDouble()); + WAYPT_SET(wpt_tmp, geoidheight, cdatastr.toDouble()) break; case tt_wpttype_cmt: wpt_tmp->description = cdatastr; @@ -1186,16 +1183,16 @@ gpx_end(const QString&) wpt_tmp->notes = cdatastr; break; case tt_wpttype_pdop: - wpt_tmp->pdop = cdatastr.toDouble(); + wpt_tmp->pdop = cdatastr.toFloat(); break; case tt_wpttype_hdop: - wpt_tmp->hdop = cdatastr.toDouble(); + wpt_tmp->hdop = cdatastr.toFloat(); break; case tt_wpttype_vdop: - wpt_tmp->vdop = cdatastr.toDouble(); + wpt_tmp->vdop = cdatastr.toFloat(); break; case tt_wpttype_sat: - wpt_tmp->sat = cdatastr.toDouble(); + wpt_tmp->sat = cdatastr.toInt(); break; case tt_wpttype_fix: if (cdatastr == QLatin1String("none")) { @@ -1780,8 +1777,8 @@ gpx_waypt_pr(const Waypoint* waypointp) gpx_write_common_acc(waypointp); if (!(opt_humminbirdext || opt_garminext)) { - fs_xml* fs_gpx = (fs_xml*)fs_chain_find(waypointp->fs, FS_GPX); - garmin_fs_t* gmsd = GMSD_FIND(waypointp); /* gARmIN sPECIAL dATA */ + auto* fs_gpx = (fs_xml*)fs_chain_find(waypointp->fs, FS_GPX); + auto* gmsd = GMSD_FIND(waypointp); /* gARmIN sPECIAL dATA */ if (fs_gpx) { if (! gmsd) { fprint_xml_chain(fs_gpx->tag, waypointp); @@ -1813,7 +1810,7 @@ gpx_track_hdr(const route_head* rte) if (gpx_wversion_num > 10) { if (!(opt_humminbirdext || opt_garminext)) { - fs_xml* fs_gpx = (fs_xml*)fs_chain_find(rte->fs, FS_GPX); + auto* fs_gpx = (fs_xml*)fs_chain_find(rte->fs, FS_GPX); if (fs_gpx) { fprint_xml_chain(fs_gpx->tag, nullptr); } @@ -1860,7 +1857,7 @@ gpx_track_disp(const Waypoint* waypointp) gpx_write_common_acc(waypointp); if (!(opt_humminbirdext || opt_garminext)) { - fs_xml* fs_gpx = (fs_xml*)fs_chain_find(waypointp->fs, FS_GPX); + auto* fs_gpx = (fs_xml*)fs_chain_find(waypointp->fs, FS_GPX); if (fs_gpx) { fprint_xml_chain(fs_gpx->tag, waypointp); } @@ -1902,7 +1899,7 @@ gpx_route_hdr(const route_head* rte) if (gpx_wversion_num > 10) { if (!(opt_humminbirdext || opt_garminext)) { - fs_xml* fs_gpx = (fs_xml*)fs_chain_find(rte->fs, FS_GPX); + auto* fs_gpx = (fs_xml*)fs_chain_find(rte->fs, FS_GPX); if (fs_gpx) { fprint_xml_chain(fs_gpx->tag, nullptr); } @@ -1939,7 +1936,7 @@ gpx_route_disp(const Waypoint* waypointp) gpx_write_common_acc(waypointp); if (!(opt_humminbirdext || opt_garminext)) { - fs_xml* fs_gpx = (fs_xml*)fs_chain_find(waypointp->fs, FS_GPX); + auto* fs_gpx = (fs_xml*)fs_chain_find(waypointp->fs, FS_GPX); if (fs_gpx) { fprint_xml_chain(fs_gpx->tag, waypointp); } -- 2.30.2